<template>
    <div class="femceMap_box">
        <div id="femceMap" ref="femceMap"></div>
        <div class="map_add">
            <el-input v-model="addSearch" placeholder="请输入内容" @input="addressInput" clearable >
                <template #prepend>地址搜索</template>
            </el-input>
            <ul class="map_add_list" v-if="addSearchList.length != 0">
                <li v-for="(addtxt, index) in addSearchList" key="index" @click="addlistButton(addtxt)" >
                    <span>{{ addtxt.name }}</span>
                    <var>{{ addtxt.address }}</var>
                    <!-- <i>{{ addtxt.location.lng + ", " + addtxt.location.lat }}</i> -->
                </li>
            </ul>
        </div>
    </div>
</template>
  
<script>
import AMapLoader from '@amap/amap-jsapi-loader';

let Map = null;
let AMap = null;
let mouseTool = null;
let mouseToolBox = null;
let weixinglayer = null;
let roadNetLayer = null;
let zoomCtrl = null;
let controlBar = null;
let districtExplorer = null; // 行政区域
let list2D = null; //范围列表
let markerList = {};

let tempOverlays = []; // 用于跟踪由mouseTool和districtExplorer添加的临时覆盖物

export default {
name: "femceMap",
data() {
    return {
        mapstate: null,
        weixingState:false,
        roadNetState:false,
        zoomCtrlState:false,
        controlBarState:false,
        

        stringLalo:'', // string 保存的字符串
        mapStyle:'',

        fenceShape:null, // circle / polygon
        infoWindow:true, // 信息窗体

        addSearch: null, //搜索地址
        addSearchList: [], //搜索地址列表
    };
},
components:{

},
created() {
},
mounted() {
    this.addMapCase();
},
methods: {
    fun(){
        console.log('fun fenceMap');
    },
    //地图搜索input 关键字搜索
    addressInput() {
      if (this.addSearch == "") {
        this.addSearchList = [];
        return;
      }
      console.log(this.addSearch);
      let keyword = this.addSearch;
      AMap.plugin("AMap.PlaceSearch", () => {
        var autoOptions = {
          city: "全国",
        };
        let placeSearch = new AMap.PlaceSearch(autoOptions);
        placeSearch.search(keyword, (status, result) => {
          // 搜索成功时，result即是对应的匹配数据
          if (result == "USER_DAILY_QUERY_OVER_LIMIT") {
            this.$message.error("今日 关键词搜索 已用完 !~");
          } else {
            this.addSearchList = result.poiList.pois;
            console.log(result.poiList.pois);
          }
        });
      });
    },
    // 地址 搜索地图
    addlistButton(address) {
        Map.setZoomAndCenter( 16, [address.location.lng, address.location.lat], true, 3000 );
        this.addSearchList = [];
        this.addSearch = address.name + " " + address.address;
    },
    //信息窗体
    infoWindowFun(){
        return new Promise((resolve, reject) => {
            this.infoWindow = !this.infoWindow;
            resolve(this.infoWindow);
        });
    },
    // 方向盘
    toggleControlBar() {
        return new Promise((resolve, reject) => {
            if (!controlBar) {
                // 第一次调用时创建ControlBar实例
                controlBar = new AMap.ControlBar({
                    // 控件位置
                    position: {
                        top: '10px',
                        right: '10px'
                    },
                    // 可见性控制
                    visible: true,
                    // 更多可用选项...
                });
                Map.addControl(controlBar);
                this.controlBarState = true; // 控制控件的显示状态
            } else {
                // 如果已经创建，则根据当前状态切换可见性
                if (this.controlBarState) {
                    // 如果当前为显示状态，则隐藏
                    controlBar.hide();
                    this.controlBarState = false;
                } else {
                    // 如果当前为隐藏状态，则显示
                    controlBar.show();
                    this.controlBarState = true;
                }
            }
            resolve(this.controlBarState);
        });
    },
    //缩放功能
    scale(){
        return new Promise((resolve, reject) => {
            if (!zoomCtrl) {
                AMapUI.loadUI(['control/BasicControl'], BasicControl => {
                    zoomCtrl = new BasicControl.Zoom({
                        theme: 'dark',
                        position: 'br',
                    });
                    Map.addControl(zoomCtrl);
                    this.zoomCtrlState = true;
                    resolve(this.zoomCtrlState);
                });
            } else {
                if (this.zoomCtrlState) {
                    Map.removeControl(zoomCtrl);
                    this.zoomCtrlState = false;
                } else {
                    Map.addControl(zoomCtrl);
                    this.zoomCtrlState = true;
                }
                resolve(this.zoomCtrlState);
            }
        });
    },
    //交通图层 公路网RoadNet
    roadNetFun() {
        if (!roadNetLayer) {
            roadNetLayer = new AMap.TileLayer.Traffic();
        }
        if (this.roadNetState) {
            roadNetLayer.setMap(null);
            this.roadNetState = false;
        } else {
            roadNetLayer.setMap(Map);
            this.roadNetState = true;
        }

        // 返回一个 Promise，解析为当前交通图层的状态
        return new Promise((resolve, reject) => {
            resolve(this.roadNetState);
        });
    },                                                
    //卫星
    weixing(){
        if(!weixinglayer){
            weixinglayer = new AMap.TileLayer.Satellite(); //添加卫星图层
        };
        if(this.weixingState){
            weixinglayer.setMap(null);
            this.weixingState = false;
        }else{
            weixinglayer.setMap(Map);
            this.weixingState = true;
        };
        return new Promise((resolve, reject)=>{
            resolve(this.weixingState)
        });
    },
    // 绘制圆形
    mouseToolCircleFun(){
        if (!mouseTool) {
            AMap.plugin(["AMap.MouseTool"], ()=>{ //插件初始化前需要引入的插件
                mouseTool = new AMap.MouseTool(Map);
            });
        } else {
            this.removeMouseToolFun(); // 停止并清除当前的绘制工具实例
        };
        this.stringLalo ='';
        this.fenceShape = 'circle';
        this.removeMouseToolFun();
        this.$message({
            message: '提示：鼠标左键按住拖拽',
            type: 'success'
        });
        Map.setDefaultCursor('crosshair');
        
        // 开始绘制圆形
        mouseTool.circle({
            strokeColor: '#F56C6C',
            strokeOpacity: 1, // 边框透明度
            strokeWeight: 2,
            fillColor: '#F56C6C',
            fillOpacity: 0.3, // 内部颜色透明度
            strokeStyle: 'dashed'
        });

        // 监听 draw 事件可获取画好的覆盖物对象
        mouseTool.on('draw', event => {
            console.log(event.obj, '为绘制出来的覆盖物对象');
            mouseToolBox = event.obj;

            this.mouseToolCircleFunOKK();
        });

        // 结束
        mouseTool.on('end', e => {
            console.log(e, '结束事件');
        });
    },

    // 绘制圆形完毕触发
    mouseToolCircleFunOKK() {
        mouseTool.close();
        // 设置圆形的样式为绘制完成后的样式
        mouseToolBox.setOptions({
            strokeStyle: 'solid',
            fillOpacity: 0.2,
            strokeColor: '#67C23A', 
            strokeOpacity: 1,
            strokeWeight: 2,
            fillColor: '#67C23A',
            fillOpacity: 0.3,
        });
        Map.setDefaultCursor(''); // 鼠标样式
        
        // 获取圆形的中心点
        let center = mouseToolBox.getCenter().lat + ',' + mouseToolBox.getCenter().lng;
        console.log('获取圆形的中心点', mouseToolBox.getCenter().lat + ',' + mouseToolBox.getCenter().lng );
        // 获取圆形的半径，单位为米
        let radius = mouseToolBox.getRadius();
        tempOverlays.push(mouseToolBox); // 将创建的圆形覆盖物添加到tempOverlays数组中
        console.log("圆心位置:", center.toString(), "半径(米):", radius);

    },
    //绘制多边形
    mouseToolFun(){
        if (!mouseTool) {
            AMap.plugin(["AMap.MouseTool"], ()=>{ //插件初始化前需要引入的插件
                mouseTool = new AMap.MouseTool(Map);
            });
        } else {
            this.removeMouseToolFun(); // 停止并清除当前的绘制工具实例
        };

        this.stringLalo ='';
        this.fenceShape = 'polygon';
        this.removeMouseToolFun();
        this.$message({
        message: '提示：鼠标双击 结束编辑',
        type: 'success'
        });
        Map.setDefaultCursor('crosshair');
        mouseTool.polygon({
            strokeColor: '#F56C6C', 
            strokeOpacity: 1, //border 透明度
            strokeWeight: 2,
            fillColor: '#F56C6C',
            fillOpacity: .3, //内部颜色透明度
            // 线样式还支持 'dashed'
            strokeStyle: "dashed",
            // strokeStyle是dashed时有效
            // strokeDasharray: [30,10],
        });
        //监听draw事件可获取画好的覆盖物
        mouseTool.on('draw', event=> { //绘制完毕触发事件
            // event.obj 为绘制出来的覆盖物对象
            console.log(event.obj, '为绘制出来的覆盖物对象');
            mouseToolBox = event.obj;
            this.mouseToolFunOKK();

        });
        //结束
        mouseTool.on('end', (e) => {
            console.log(e, '结束事件');
        });
    },

    //绘制完毕触发
    mouseToolFunOKK(){
        console.log(mouseToolBox, '为绘制出来的覆盖物对象');
        mouseTool.close() // 结束编辑 close()
        //this.mouseTool.close(true)//关闭编辑，并清除覆盖物
        mouseToolBox.setOptions({
            strokeStyle: 'solid',
            fillOpacity: .2,
            strokeColor: '#67C23A', 
            strokeOpacity: 1, //border 透明度
            strokeWeight: 2,
            fillColor: '#67C23A',
            fillOpacity: .3, //内部颜色透明度
        });
        Map.setDefaultCursor(''); // 鼠标样式
        tempOverlays.push(mouseToolBox); // 将创建的多边形覆盖物添加到tempOverlays数组中
    },

    //删除范围
    removeMouseToolFun(){
        this.stringLalo ='';
        tempOverlays.forEach(overlay => { //清除绘制内容
            Map.remove(overlay);
        });
        this.tempOverlays = []; // 清空数组
        //清除已有的行政绘制内容
        /* if(districtExplorer && districtExplorer.clearFeaturePolygons){
            districtExplorer.clearFeaturePolygons();
        }; */
        //清除编辑的覆盖物
        if(mouseToolBox){Map.remove(mouseToolBox)};
        //this.mouseTool.close(true)//关闭编辑，并清除覆盖物
        mouseToolBox = null;
        // 清除地图上所有添加的覆盖物
        /* Map.clearMap(); */
    },
    //添加范围范围
    addMouseToolFun(){
        if(mouseTool){
            mouseTool.close();
        };
        this.stringLalo = '';
        let data = {};
        if(this.fenceShape == null){
            if(!mouseToolBox || !mouseToolBox.getPath){
                this.$message.error('请添加 规则范围');
                return;
            };
        }else if(this.fenceShape == 'circle'){
            // 获取圆形的中心点
            let center = mouseToolBox.getCenter().lat + ',' + mouseToolBox.getCenter().lng
            // 获取圆形的半径，单位为米
            let radius = mouseToolBox.getRadius();

            console.log("圆心位置:", center, "半径(米):", radius);
            data = {fenceShape:'circle', geom:center, radius:radius, admAreaCode:null, scale:Map.getZoom()}
        }else if(this.fenceShape == 'polygon'){
            if(!mouseToolBox || !mouseToolBox.getPath){
                this.$message.error('请添加 规则范围');
                return;
            };
            console.log(mouseToolBox);
            let posList = mouseToolBox.getPath();
            console.log(posList);
            posList.map( (item, index) => {
            //console.log(item.kT, item.KL, index); // 2.0
            this.stringLalo += item.lat + ',' + item.lng;
            if(posList.length != index+1){
                this.stringLalo += '|';
            };
            });
            console.log(this.stringLalo);
            data = {fenceShape:'polygon', geom:this.stringLalo, radius:null, admAreaCode:null, scale:Map.getZoom()}

        }else if(typeof(this.fenceShape) == 'string'){
            if(this.fenceShape == ''){
                this.$message.error('请添加 规则范围');
                return;
            };
            console.log(this.stringLalo);
            data = {fenceShape:null, geom:null, radius:null, admAreaCode:this.fenceShape, scale:Map.getZoom()}
        }else{
            this.$message.error('页面 可能搞错');
            return;
        };

        return new Promise((resolve, reject)=>{
            resolve(data);
        });

    },
    //绘制行政
    districtExplorerFun(adcode){
        console.log('绘制行政');
        this.stringLalo ='';
        this.fenceShape = adcode;
        this.removeMouseToolFun();
        AMapUI.loadUI(['geo/DistrictExplorer'], DistrictExplorer=> {
            console.log('初始化 DistrictExplorer 实例  行政UI插件');
            districtExplorer = new DistrictExplorer({
                map: Map // 设置地图实例
            });
            //adcode = 370100; //全国的区划编码
            districtExplorer.loadAreaNode(adcode, (error, areaNode)=> {
                if (error) {
                    console.error(error);
                    return;
                }
                //绘制载入的区划节点
                this.renderAreaNode(areaNode);
            });
        });
    },
    //绘制载入的区划节点
    renderAreaNode(areaNode){

        //清除已有的绘制内容
        districtExplorer.clearFeaturePolygons();

        //just some colors
        var colors = ["#3366cc", "#dc3912", "#ff9900", "#109618", "#990099", "#0099c6", "#dd4477", "#66aa00"];

        //绘制子级区划
        /* districtExplorer.renderSubFeatures(areaNode, function(feature, i) {

            var fillColor = colors[i % colors.length];
            var strokeColor = colors[colors.length - 1 - i % colors.length];

            return {
                cursor: 'default',
                bubble: true,
                strokeColor: strokeColor, //线颜色
                strokeOpacity: 1, //线透明度
                strokeWeight: 1, //线宽
                fillColor: fillColor, //填充色
                fillOpacity: 0.35, //填充透明度
            };
        }); */

        //绘制父级区划，仅用黑色描边
        districtExplorer.renderParentFeature(areaNode, {
            cursor: 'default',
            bubble: true,
            
            strokeStyle: 'solid',
            fillOpacity: .2,
            strokeColor: '#67C23A', 
            strokeOpacity: 1, //border 透明度
            strokeWeight: 2,
            fillColor: '#67C23A',
            fillOpacity: .3, //内部颜色透明度
        });

        /* let parentFeature = areaNode.getParentFeature();
        let geometry = parentFeature.geometry;

        if (geometry.type === "Polygon") {
            // 对于单个多边形
            let coordinates = geometry.coordinates[0]; // 获取第一个多边形的坐标数组
            console.log(coordinates); // 打印多边形的坐标
        } else if (geometry.type === "MultiPolygon") {
            // 对于多重多边形
            let polygons = geometry.coordinates;
            polygons.forEach(polygon => {
                let coordinates = polygon[0]; // 每个多边形的第一个坐标数组
                console.log(coordinates); // 打印多边形的坐标
            });
        } */

        //更新地图视野以适合区划面
        let createdOverlays = districtExplorer.getAllFeaturePolygons();
        
        createdOverlays.forEach(overlay => {
            tempOverlays.push(overlay);
        });

        Map.setFitView(createdOverlays);
            
    },

    //加载高德地图
    addMapCase(){
        if(this.mapstate !== null){
            return;
        };
        return new Promise((resolve, reject)=>{
            AMapLoader.load({
                "key": "aa710f496404ee0f3af9f770b8592c73",              // 申请好的Web端开发者Key，首次调用 load 时必填
                "version": '2.0',   // 指定要加载的 JS API 的版本，缺省时默认为 1.4.15 "2.0"
                "plugins": ['AMap.HawkEye', 'AMap.ControlBar'],           // 需要使用的的插件列表，如比例尺'AMap.Scale'等 鹰眼
                AMapUI: {
                    // 是否加载 AMapUI，缺省不加载
                    version: '1.1', // AMapUI 缺省 1.1
                    plugins:['geo/DistrictExplorer'], // 需要加载的 AMapUI ui插件
                },
            }).then((AMaps)=>{
                AMap = AMaps;
                Map = new AMap.Map('femceMap',{  //设置地图容器id
                    viewMode:"2D",    //是否为3D地图模式
                    zoom:5,           //初始化地图级别 5
                    center: [109.699734,31.809243],//mapVuex.mapConfig.center, //初始化地图中心点位置 [109.699734,31.809243] [105.438139,33.125266]
                    mapStyle: 'amap://styles/fresh',
                    pitch:0, // 地图俯仰角度，有效范围 0 度- 83 度
                });
                
                this.mapstate = 0;
                // 地图加载完执行
                Map.on("complete", ()=>{

                    /* AMap.plugin(["AMap.MouseTool"], ()=>{ //插件初始化前需要引入的插件
                        //创建MouseTool实例
                        if(!mouseTool){
                            mouseTool = new AMap.MouseTool(Map);
                        };
                    }); */
                    // 引入行政插件
                    /* AMapUI.loadUI(['geo/DistrictExplorer'], DistrictExplorer=> {
                        console.log('初始化 DistrictExplorer 实例  行政UI插件');
                        if(!districtExplorer){
                            districtExplorer = new DistrictExplorer({
                                map: Map // 设置地图实例
                            });
                        };
                    }); */
                    Map.on('moveend', this.minMapFun); //移动结束执行
                    Map.on('zoomend', this.minMapFun) //缩放结束执行
                    this.mapstate = 1;
                    resolve('地图加载完执行')
                });
            }).catch(e => {
                console.log('地图加载 报错', e);
                // 销毁地图，并清空地图容器 地图对象被注销，内存释放，地图容器被清空。
                if(Map){
                    if(Map.destroy){
                    Map.destroy();
                    if(this.$refs.femceMap.children.length == 0){
                        console.log("地图为空");
                        setTimeout(()=>{
                        this.mapstate = null;
                        this.addMapCase();
                        }, 3000);
                    };
                    };
                };
            });
        });
    },

    //地图重置
    resettingMap(){
        Map.setZoomAndCenter(5, [109.699734,31.809243], true, 2000); 
    },

    //范围列表
    fencelistFun(data){
        console.log('范围列表', data);
        if(data.length < 1){
            this.resettingMap();
        };
        Map.clearMap();
        list2D={}
        data.map(fence=>{
            let fenceColor = this.fenceColor(fence.status);
            if(fence.fenceShape == "polygon" && fence.geom){
                let pathAttr = [];
                fence.geom.split('|').map( (item, index) => {
                    let xy = item.split(',');
                    pathAttr[index] = [Number(xy[1]), Number(xy[0])];
                });
                //console.log(pathAttr);

                //大边框 
                list2D['fence'+fence.id] = new AMap.Polygon({
                    path:pathAttr,
                    fillColor: fenceColor,
                    strokeOpacity: 1,
                    fillOpacity: 0.3,
                    strokeColor: fenceColor,
                    strokeWeight: 2,
                    strokeStyle: 'dashed',
                    strokeDasharray: [10, 5],
                    name:'fence'+fence.id,
                });
            }else if(fence.fenceShape == "circle") {
                // 圆形范围处理
                let center = fence.geom.split(',');
                let radius = Number(fence.radius);

                list2D['fence'+fence.id] = new AMap.Circle({
                    center: new AMap.LngLat(Number(center[1]), Number(center[0])), // 圆心位置
                    radius: radius,  // 半径
                    fillColor: fenceColor, // 填充颜色
                    strokeColor: fenceColor, // 边框颜色
                    strokeOpacity: 1,
                    fillOpacity: 0.3,
                    strokeWeight: 2,
                    strokeStyle: 'dashed',
                    strokeDasharray: [10, 5], // 虚线
                    name: 'fence'+fence.id,
                });
            }else if(fence.fenceShape == "polygon" && fence.admAreaCode) {
                // 行政区域处理
                this.addDistrict(fence.admAreaCode, 'fenceAdm'+fence.id, fenceColor);
            }
            
            if(list2D['fence'+fence.id]) {
                Map.add(list2D['fence'+fence.id]);
            }
            Map.setFitView();
        });
        if(this.infoWindow){
            this.markerListFun(data);
        };
    },

    // 添加行政区域的函数
    addDistrict(adcode, name, fenceColor) {
        AMapUI.loadUI(['geo/DistrictExplorer'], DistrictExplorer=> {
            console.log('初始化 DistrictExplorer 实例  行政UI插件');
            districtExplorer = new DistrictExplorer({
                map: Map // 设置地图实例
            });
            //adcode = 370100; //全国的区划编码
            districtExplorer.loadAreaNode(adcode, (error, areaNode)=> {
                if (error) {
                    console.error(error);
                    return;
                }

                //绘制父级区划
                districtExplorer.renderParentFeature(areaNode, {
                    cursor: 'default',
                    bubble: true,
                    
                    strokeStyle: 'solid',
                    strokeDasharray: [10, 5],
                    fillOpacity: .3,
                    strokeColor: fenceColor, 
                    strokeOpacity: 1, //border 透明度
                    strokeWeight: 2,
                    fillColor: fenceColor,
                    fillOpacity: .3, //内部颜色透明度
                    name:name,
                });

                districtExplorer.getAllFeaturePolygons();
                //更新地图视野以适合区划面
                Map.setFitView();
            });

        });
    },
    //信息窗体
    markerListFun(data){
        
        let boxContent = (s) =>{
            return `
            <div class="map_ico">
                <div class="map_ico_box">
                    围栏名称：${s.fenceName} <br />
                    ${s.description && s.description != '' ? `<div>
                        围栏描述：<br />
                        ${s.description}
                    </div>` : ''}
                </div>
            </div>`;
        };

        data.map(fence=>{
            console.log(fence);
            if(fence.fenceShape == "polygon" && fence.geom){
                let pathAttr = fence.geom.split('|').map(item => {
                    let xy = item.split(',');
                    return [Number(xy[1]), Number(xy[0])]; // 注意这里先是经度，后是纬度
                });

                // 计算多边形顶点的平均经纬度来近似得到中心点
                let center = pathAttr.reduce((accumulator, currentValue) => {
                    return [accumulator[0] + currentValue[0] / pathAttr.length, accumulator[1] + currentValue[1] / pathAttr.length];
                }, [0, 0]);

                // 使用中心点作为标注位置
                markerList['marker' + fence.id] = new AMap.Marker({
                    position: center, // 使用计算得到的中心点坐标
                    content: boxContent(fence), // 假设boxContent是一个函数，返回标注的HTML内容
                    offset: new AMap.Pixel(0, 0),
                    zIndex: 60,
                });
                Map.add(markerList['marker' + fence.id]);

                // 为标记添加点击事件
                markerList['marker' + fence.id].on('click', function (e) {
                    console.log('fence'+fence.id);
                    Map.setFitView([list2D['fence'+fence.id]]);
                });
            }else if(fence.fenceShape == "circle") {
                // 圆形范围处理
                let center = fence.geom.split(',');

                markerList['marker' + fence.id] = new AMap.Marker({
                    position: [center[1],center[0]], // 盒子坐标
                    content: boxContent(fence),
                    offset: new AMap.Pixel(0, 0),
                    zIndex: 60,
                });
                Map.add(markerList['marker' + fence.id]);

                // 为标记添加点击事件
                markerList['marker' + fence.id].on('click', function (e) {
                    console.log('fence'+fence.id);
                    Map.setFitView([list2D['fence'+fence.id]]);
                });
            }else if(fence.fenceShape == "polygon" && fence.admAreaCode) {
                //行政窗体
            };
        });

    },
    // 围栏颜色
    fenceColor(c){
        const colorMap = {
            'in': '#F56C6C',
            'out': '#E6A23C'
        };
        return colorMap[c] || '#409EFF'; 
    },
    // 地图预览
    minMapFun(){
        //console.log('缩放结束', Map.getCenter(), Map.getZoom());
        this.$emit('setMinMapFun', Map.getCenter(), Map.getZoom());
    },
},
};
</script>
  
<style lang='scss' scoped>
.femceMap_box, #femceMap{
    width: 100%;
    height: 100%;
}
.map_add {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 99;
  font-size: 16px;
  display: flex;
  flex-direction: row;
  width: 50%;
  max-width: 400px;
  .map_add_list {
    position: absolute;
    top: 40px;
    left: 0;
    list-style: none;
    padding: 5px;
    border: solid 1px #c5c9d7;
    border-radius: 5px;
    background: #fff;
    box-shadow: 1px 1px 5px 1px rgba(0, 0, 0, 0.3);
    width: 100%;
    > li {
        color: #606266;
        font-size: 16px;
        padding:10px 5px;
        border-bottom: dashed 1px #dadff2;
        box-sizing: content-box;
        display: flex;
        line-height: 16px;
        cursor: pointer;
        gap: 5px;
        span {
            font-weight: bold;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            flex-grow:1;
        }
        var {
            margin-left: auto;
            padding: 0 10px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            font-size: 12px;
        }
        i {
            color: #868b97;
            max-width: 30%;
            font-size: 12px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        }
        > li:last-child {
            border-width: 0;
        }
        > li:hover {
            background: #e9ecf5;
        }
    }
}

</style>
<style lang='scss'>
.map_ico{
  position: absolute;
  top:0;
  left: 0;
  width: 0px;
  height: 0px;
    .map_ico_box {
        position: absolute;
        width: 160px;
        border-radius: 5px;
        background: linear-gradient(135deg, rgba(64, 158, 255) 0%, rgb(62, 142, 223) 100%,);
        color: #fff;
        left: -50px;
        bottom: 10px;
        font-size: 0.6em;
        white-space: normal; /* 确保文本能够换行 */
        padding: 4px;
        box-shadow: 1px 1px 5px 1px rgba(0,0,0,0.2);
        transition: background-color 600ms ease;
        .map_ico_content{
            display: block;
        }
    }
    .map_ico_box:hover{
        transition: background-color 600ms ease;
        box-shadow: 1px 1px 5px 1px rgba(0,0,0,0.3);
    }
}
</style>